
public class Counter implements java.io.Serializable {

	/**
	 * 
	 */
	private static final long serialVersionUID = 8008586180319134345L;
	private int cpt;
	private String writer;

	public Counter() {
		this.cpt = 0;
		this.writer = null;
	}

	public int increment(String w) {
		this.writer = w;
		return cpt++;

	}

	public int decrement(String w) {
		this.writer = w;
		return cpt--;
	}

	public void read() {
		if (writer == null)
			System.out.println("The value is " + cpt);
		else
			System.out.println(writer + " has changed value to " + cpt);
	}

}
